<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title></title>
</head>
<script src="../js/easyui-1.3.5/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/ajax.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
var reg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/;
var rootName=ajax.getRootName();
$(function() {
	$("input[name=submit_url").click(function() {
		$("#status_code").html("");
		var url = $("input[name=url]").val();
		if(!url) {
			alert("内容不能为空");
		} else {
			checkURL(url);
		}
	});
});

function checkURL(url) {
	if(reg.test(url)) {
		$.get(rootName+"/api/url/detection", {
			"url": url
		}, function(msg) {
			$("#status_code").html(msg);
		});
	} else {
		alert(url + ":不是一个邮箱网址")
	}
}
</script>

<body>
<label>url功能测试</label>
<lable>url:</lable><input type="text" name="url" value="http://www.baidu.com"/><input type="button" name="submit_url" value="提交url" /><span id="status_code"></span>
</body>

</html>